package work20241203_chap6oop.e_demo3;

/**
 * @author zdl
 * @date 2024/12/3
 */
class Super {
    public void method() {
        System.out.println("method() in Super");
    }

    public void method(int i) {
        System.out.println("method(int) in Super");
    }
}

class Sub extends Super {
    public void method() {
        System.out.println("method() in Sub");
    }

    public void method(String str) {
        System.out.println("method(String) in Sub");
    }
}

public class TestSuperSub {
    public static void main(String args[]) {
        Super s = new Sub(); //向上转型
        s.method(10); //method(int) in Super
        s.method();//method() in Super
       // s.method("hello");
    }
}
